<?php
namespace app\wxapi\controller;

use think\facade\View;
use app\index\model\Contentmodel;
use think\App;

class Listing extends Common
{
    protected $contentmodel;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->contentmodel = new Contentmodel();
    }

    public function index(){
        $articleList = $this->contentmodel->findAll([['a.status', '=', 1], ['a.examine_status', '=', 9]], $this->request->param());
		foreach($articleList['data'] as $key=>$val){
            $imgSize = getimagesize('http://'.$_SERVER['SERVER_NAME'].$val['img']);//print_r($imgSize);
            $articleList['data'] [$key]['CoverWidth'] = $imgSize[0];
            $articleList['data'] [$key]['CoverHeight'] = $imgSize[1];
        }
        $this->showData['articleList'] = $articleList['data'];
		return json(['code'=>200, 'result'=>'success', 'data'=>$this->showData]);
	}
}
